var mongoose = require('../common/db');

var comment = new mongoose.Schema({
	movie_id: String,
	username: String,
	context: String,
	check: Boolean,
});

// 根据movie的id查找评论
comment.statics.findByMovieId = function (m_id, callBack) {
	this.find({ movie_id: m_id, check: true }, callBack);
};

// 查找全部评论
comment.statics.findAll = function (callBack) {
	this.find({}, callBack);
};

var commentModel = mongoose.model('Comment', comment);

module.exports = commentModel;
